﻿package frEngine.animateControler
{
    import baseEngine.core.*;
    import baseEngine.system.*;
    import flash.utils.*;
    import frEngine.shader.*;
    import frEngine.shader.filters.fragmentFilters.*;
    import frEngine.shader.filters.fragmentFilters.extra.*;
    import frEngine.shader.filters.vertexFilters.*;
    import frEngine.shader.md5shader.*;

    public class Md5MaterialManager extends Object
    {
        private var _depthMaterialMap:Dictionary;
        private var _edgeMaterialMap:Dictionary;
        private var _shadowMaterialMap:Dictionary;
        private var _xRayMaterialMap:Dictionary;
        private var _outLightingMaterialMap:Dictionary;
        public static const instance:Md5MaterialManager = new Md5MaterialManager;

        public function Md5MaterialManager()
        {
            var _loc_10:int = 0;
            this._depthMaterialMap = new Dictionary(false);
            this._edgeMaterialMap = new Dictionary(false);
            this._shadowMaterialMap = new Dictionary(false);
            this._xRayMaterialMap = new Dictionary(false);
            this._outLightingMaterialMap = new Dictionary(false);
            var _loc_1:* = new OutLightingFilter();
            var _loc_2:* = new XRayFilter();
            var _loc_3:* = new TextureFilter(Global3D.nullBitmapDataTexture);
            var _loc_4:* = new ColorFilter(1, 0, 0, 0);
            var _loc_5:* = new ColorFilter(1, 0, 0, 1);
            var _loc_6:* = new ColorFilter(0, 0, 0, 0.3);
            var _loc_7:* = new TransformFilter();
            var _loc_8:* = new ShadowVertexFilter();
            var _loc_9:int = 1;
            while (_loc_9 <= 4)
            {
                
                _loc_10 = _loc_9 % 4;
                this._depthMaterialMap[_loc_10] = new DepthShader(_loc_10, _loc_7, _loc_4);
                this._edgeMaterialMap[_loc_10] = new EdgeSahder(_loc_10, _loc_7, _loc_3);
                this._shadowMaterialMap[_loc_10] = new ShadowShader(_loc_10, _loc_8, _loc_6);
                this._xRayMaterialMap[_loc_10] = new XRayShader(_loc_10, _loc_7, _loc_2);
                this._outLightingMaterialMap[_loc_10] = new OutLightingShader(_loc_10, _loc_7, _loc_3);
                _loc_9++;
            }
            return;
        }// end function

        public function getDepthMaterial(param1:int, param2:Number, param3:Number, param4:Number, param5:Number) : DepthShader
        {
            var _loc_6:* = this._depthMaterialMap[param1];
            _loc_6.changeParams(param2, param3, param4, param5);
            return _loc_6;
        }// end function

        public function getEdgeMaterial(param1:int, param2:Number, param3:Number, param4:Number, param5:Texture3D) : EdgeSahder
        {
            var _loc_6:* = this._edgeMaterialMap[param1];
            _loc_6.changeParams(param2, param3, param4, param5);
            return _loc_6;
        }// end function

        public function getShadowMaterial(param1:MaterialParams) : ShadowShader
        {
            var _loc_2:* = param1.skinNum;
            var _loc_3:* = param1.alphaBaseValue;
            var _loc_4:* = this._shadowMaterialMap[_loc_2];
            _loc_4.changeParams(_loc_3);
            return _loc_4;
        }// end function

        public function getXRayMaterial(param1:int) : XRayShader
        {
            var _loc_2:* = this._xRayMaterialMap[param1];
            _loc_2.changeParams();
            return _loc_2;
        }// end function

        public function getOutLightingMaterial(param1:int, param2:Number, param3:Number, param4:Number, param5:Number, param6:Texture3D, param7:Number) : OutLightingShader
        {
            var _loc_8:* = this._outLightingMaterialMap[param1];
            _loc_8.changeParams(param2, param3, param4, param5, param6, param7);
            return _loc_8;
        }// end function

    }
}
